<?php

namespace app\admin\model;

use app\common\model\Base;

class Test extends Base {
  protected $name = 'test';
  protected $updateTime = FALSE;

  public function initialize() {
    parent::initialize();
  }

  public function getStatusTextAttr($value, $data) {
    $status = ['启用',
               '禁用'];

    return $status[ $data['status'] ];
  }

  public function getQConfigTextAttr($value, $data) {
    $qType = config('question')['type'];
    $arr = json_decode($data['q_config'], TRUE);
    $return=[];
    foreach ($arr as $k => $v) {
      $return[]=$qType[$k].$v['num'].'题，每题分数'.$v['score'];
    }

    return implode(';', $return);
  }
}